fix: make the remaining test suite pass on Windows#335
fix: make the remaining test suite pass on Windows#335ShreyanshVaibhaw wants to merge 2 commits into
Conversation
Follow-up to huggingface#326, which fixed test_coding_session.py. The rest of the suite had 9 more Windows failures in three categories: 1. Bash-specific tests (test_coding_tools.py): shell_command_prefix routing and job control (sleep & wait) only apply on POSIX, so the three tests exercising them are now skipif win32, matching the markers added to test_coding_session.py in huggingface#326. 2. POSIX permission bits (test_credentials.py): chmod(0o600) cannot be asserted via S_IMODE on Windows filesystems, so the assertion is now guarded to POSIX. 3. Path-separator assumptions (test_system_prompt.py, test_tui_app.py): build_system_prompt normalizes the cwd to forward slashes on every platform while the test expected the native form; four TUI tests expected the opposite - hardcoded forward-slash paths where the product renders str(Path(...)) with native separators. Expectations now derive from the same formatting the product uses.
_styled_cwd split the displayed path on '/', so on Windows (backslash separators) the parent-as-metadata styling silently never applied. Split on whichever separator appears last instead; the displayed string is unchanged.
793b621 to
3bd4379
Compare
|
Rebased on current main (resolved conflicts with the new system-prompt and sidebar assertions added since this PR was opened; the merged conflict resolutions keep upstream's new checks and apply the platform-neutral path expectations on top). The rebase also surfaced one small product fix now included here: Also observed while validating: |
Summary
Follow-up to #326 (merged), which fixed
tests/test_coding_session.pyon Windows. Running the rest of the suite on Windows surfaced 9 more failures on unmodifiedmain, in three categories. This PR fixes all of them; the full suite on Windows now reports 730 passed, 6 skipped, 0 failed. Test-only change - no product code touched, POSIX runs unaffected.Root causes and fixes
1. Bash-specific tests (3 tests,
test_coding_tools.py)test_create_coding_tools_applies_shell_command_prefix,test_bash_tool_applies_opt_in_shell_command_prefix, andtest_bash_tool_cancellation_kills_shell_childrenrely on bash behavior:shell_command_prefixonly routes through bash on POSIX (os.name == "posix"branch increate_bash_tool), andsleep 1 & waitis bash job control. Markedskipif(sys.platform == "win32")with arequires_posix_shellmarker, matching the pattern accepted in #326.2. POSIX permission bits (1 test,
test_credentials.py)test_file_credential_store_round_trips_and_sets_private_permissionsassertsS_IMODE(...) == 0o600afterchmod(0o600), but Windows filesystems do not honor those bits (stat reports 0o666). The round-trip assertions still run everywhere; only the permission-bit check is now gated to POSIX.3. Path-separator assumptions (5 tests,
test_system_prompt.py+test_tui_app.py)Two opposite mismatches:
build_system_promptdeliberately normalizes the cwd to forward slashes on every platform (_format_path), but the test expected the nativestr(tmp_path)form. The expectation now applies the same normalization./workspace/project,.agents/AGENTS.md, export/resume paths) where the product rendersstr(Path(...))with native separators. Expectations now derive fromPathso they are correct on every platform.Notes
HOME-only monkeypatch pattern flagged in Test suite fails on Windows and mutates the developer's real ~/.tau settings #325 fortest_cli.py/test_tui_app.pyno longer exists on currentmain, so there was nothing to extend there.test_streaming_code_block_hides_horizontal_scrollbar_until_finalizedfailed once during the first full-suite run but passed 5 consecutive subsequent runs (isolated and full-file); it appears to be a rare timing flake unrelated to this change, so it is not touched here.Validation
test_coding_tools.py,test_credentials.py,test_system_prompt.py,test_tui_app.py(Windows 11, Python 3.12.7, currentmain).uv run pytest tests/-> 730 passed, 6 skipped (all POSIX-only, explicitly marked), 0 failed.ruff check tests/clean.🤖 Generated with Claude Code